package com.gw.config;

import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import springfox.documentation.swagger.web.SwaggerResource;
import springfox.documentation.swagger.web.SwaggerResourcesProvider;

import java.util.ArrayList;
import java.util.List;
@Component
@Primary
public class DocumentConfig implements SwaggerResourcesProvider {
    @Override
    public List<SwaggerResource> get() {
        // 需要的聚合的资源是什么
        //   微服务的名字
        List<SwaggerResource> list = new ArrayList<>();
        SwaggerResource swaggerResource = new SwaggerResource();
        swaggerResource.setName("订单微服务");
        // http://localhost:8800/order/t-oreder/2
        swaggerResource.setLocation("/order/v2/api-docs");
        swaggerResource.setSwaggerVersion("2.0");
        list.add(swaggerResource);

        SwaggerResource swaggerResource1 = new SwaggerResource();
        swaggerResource1.setName("商品微服务");
        // http://localhost:8800/order/t-oreder/2
        swaggerResource1.setLocation("/product/v2/api-docs");
        swaggerResource1.setSwaggerVersion("2.0");
        list.add(swaggerResource1);
        return list;
    }
}
